package com.kang.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.kang.bean.News;
import com.kang.dto.NewsDto;
import com.kang.mapper.NewsMapper;
import com.kang.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @program: service
 * @description: 消息服务列
 * @author: K.faWu
 * @create: 2022-04-19 16:19
 **/
@Service
public class NewsServiceImpl extends ServiceImpl<NewsMapper, News> implements NewsService {
    @Autowired
    private NewsMapper newsMapper;

    @Override
    public PageInfo<News> getList(NewsDto newsDto, Pageable page, HttpServletRequest request) {
        PageHelper.startPage(page.getPageNumber(), page.getPageSize());
        List<News> list = newsMapper.getList(newsDto);
        return new PageInfo<>(list);
    }
}
